<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.2">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"wrr123.github.io","root":"/","scheme":"Muse","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.json"};
  </script>

  <meta name="description" content="记录org模式中的日程的使用">
<meta property="og:type" content="article">
<meta property="og:title" content="emacs-org模式第二篇">
<meta property="og:url" content="https://wrr123.github.io/2021/07/09/emacs-org%E6%A8%A1%E5%BC%8F%E7%AC%AC%E4%BA%8C%E7%AF%87/index.html">
<meta property="og:site_name" content="一缕烟气">
<meta property="og:description" content="记录org模式中的日程的使用">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://localhost:4000/2021/07/09/emacs-org%E6%A8%A1%E5%BC%8F%E7%AC%AC%E4%BA%8C%E7%AF%87/001.png">
<meta property="article:published_time" content="2021-07-09T03:24:07.000Z">
<meta property="article:modified_time" content="2022-02-18T02:52:04.403Z">
<meta property="article:author" content="田园隐士">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://localhost:4000/2021/07/09/emacs-org%E6%A8%A1%E5%BC%8F%E7%AC%AC%E4%BA%8C%E7%AF%87/001.png">

<link rel="canonical" href="https://wrr123.github.io/2021/07/09/emacs-org%E6%A8%A1%E5%BC%8F%E7%AC%AC%E4%BA%8C%E7%AF%87/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>emacs-org模式第二篇 | 一缕烟气</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

<style>mjx-container[jax="SVG"] {
  direction: ltr;
}

mjx-container[jax="SVG"] > svg {
  overflow: visible;
}

mjx-container[jax="SVG"][display="true"] {
  display: block;
  text-align: center;
  margin: 1em 0;
}

mjx-container[jax="SVG"][justify="left"] {
  text-align: left;
}

mjx-container[jax="SVG"][justify="right"] {
  text-align: right;
}

g[data-mml-node="merror"] > g {
  fill: red;
  stroke: red;
}

g[data-mml-node="merror"] > rect[data-background] {
  fill: yellow;
  stroke: none;
}

g[data-mml-node="mtable"] > line[data-line] {
  stroke-width: 70px;
  fill: none;
}

g[data-mml-node="mtable"] > rect[data-frame] {
  stroke-width: 70px;
  fill: none;
}

g[data-mml-node="mtable"] > .mjx-dashed {
  stroke-dasharray: 140;
}

g[data-mml-node="mtable"] > .mjx-dotted {
  stroke-linecap: round;
  stroke-dasharray: 0,140;
}

g[data-mml-node="mtable"] > svg {
  overflow: visible;
}

[jax="SVG"] mjx-tool {
  display: inline-block;
  position: relative;
  width: 0;
  height: 0;
}

[jax="SVG"] mjx-tool > mjx-tip {
  position: absolute;
  top: 0;
  left: 0;
}

mjx-tool > mjx-tip {
  display: inline-block;
  padding: .2em;
  border: 1px solid #888;
  font-size: 70%;
  background-color: #F8F8F8;
  color: black;
  box-shadow: 2px 2px 5px #AAAAAA;
}

g[data-mml-node="maction"][data-toggle] {
  cursor: pointer;
}

mjx-status {
  display: block;
  position: fixed;
  left: 1em;
  bottom: 1em;
  min-width: 25%;
  padding: .2em .4em;
  border: 1px solid #888;
  font-size: 90%;
  background-color: #F8F8F8;
  color: black;
}

foreignObject[data-mjx-xml] {
  font-family: initial;
  line-height: normal;
  overflow: visible;
}

.MathJax path {
  stroke-width: 3;
}

mjx-container[display="true"] {
  overflow: auto hidden;
}

mjx-container[display="true"] + br {
  display: none;
}
</style><link rel="alternate" href="/atom.xml" title="一缕烟气" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">一缕烟气</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">沧海月明珠有泪，蓝田日暖玉生烟</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://wrr123.github.io/2021/07/09/emacs-org%E6%A8%A1%E5%BC%8F%E7%AC%AC%E4%BA%8C%E7%AF%87/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="田园隐士">
      <meta itemprop="description" content="talk is cheap, show me the code">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一缕烟气">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          emacs-org模式第二篇
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-07-09 11:24:07" itemprop="dateCreated datePublished" datetime="2021-07-09T11:24:07+08:00">2021-07-09</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-02-18 10:52:04" itemprop="dateModified" datetime="2022-02-18T10:52:04+08:00">2022-02-18</time>
              </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span><br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>7.4k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>7 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p><div style="color:Chocolate;text-align:center;display:inline-block;width:100%;">
  记录org模式中的日程的使用
</div><br><span id="more"></span></p>
<h2 id="git中查看一个文件在哪些提交修改过"><a href="#git中查看一个文件在哪些提交修改过" class="headerlink" title="git中查看一个文件在哪些提交修改过"></a>git中查看一个文件在哪些提交修改过</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">git <span class="built_in">log</span> -- begin.txt</span></span><br><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">git <span class="built_in">log</span> -p -- begin.txt</span></span><br><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">git <span class="built_in">log</span> --pretty=oneline -- begin.txt</span></span><br></pre></td></tr></table></figure>
<h3 id="查看历史中某次提交的文件内容"><a href="#查看历史中某次提交的文件内容" class="headerlink" title="查看历史中某次提交的文件内容"></a>查看历史中某次提交的文件内容</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">git show &lt;commit-id&gt;:fileName</span></span><br></pre></td></tr></table></figure>
<h3 id="用这个版本中的文件更新工作区的文件，并回滚此文件"><a href="#用这个版本中的文件更新工作区的文件，并回滚此文件" class="headerlink" title="用这个版本中的文件更新工作区的文件，并回滚此文件"></a>用这个版本中的文件更新工作区的文件，并回滚此文件</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">git checkout &lt;commit-id&gt; -- fileName</span></span><br><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">git reset fileName</span></span><br></pre></td></tr></table></figure>
<h3 id="比较历史中不同版本的文件"><a href="#比较历史中不同版本的文件" class="headerlink" title="比较历史中不同版本的文件"></a>比较历史中不同版本的文件</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">git diff &lt;commit-one&gt; &lt;commit-two&gt; -- fileName</span></span><br></pre></td></tr></table></figure>
<h2 id="emacs将只读模式修改为可写模式？"><a href="#emacs将只读模式修改为可写模式？" class="headerlink" title="emacs将只读模式修改为可写模式？"></a>emacs将只读模式修改为可写模式？</h2><p>调用函数<code>read-only-mode</code> 或者 使用<code>C-x C-q</code>快捷键,使用buffer在只读和可写两种模式之间切换.</p>
<h3 id="以只读模式打开一个文件"><a href="#以只读模式打开一个文件" class="headerlink" title="以只读模式打开一个文件"></a>以只读模式打开一个文件</h3><p><code>C-x C-r</code></p>
<h2 id="DateTimeFormat-和-JsonFormat两个注解的使用"><a href="#DateTimeFormat-和-JsonFormat两个注解的使用" class="headerlink" title="@DateTimeFormat 和 @JsonFormat两个注解的使用"></a>@DateTimeFormat 和 @JsonFormat两个注解的使用</h2><ol>
<li><p><code>@DateTimeFormat</code></p>
<p>前台数据传到后台时，进行时间格式的转换</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@DateTimeFormat(pattern = "yyyy-MM-dd")</span></span><br><span class="line"><span class="meta">@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")</span></span><br><span class="line"><span class="keyword">private</span> Date symstarttime;</span><br></pre></td></tr></table></figure></li>
<li><p><code>@JsonFormat</code></p>
<p>将从数据库中时间格式的字段转换为对应的实体类时，进行格式的转换</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//设置时区为上海时区，时间格式自己据需求定。</span></span><br><span class="line"><span class="meta">@JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")</span></span><br><span class="line"><span class="keyword">private</span> Date testTime;</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="java8，stream流进阶操作"><a href="#java8，stream流进阶操作" class="headerlink" title="java8，stream流进阶操作"></a>java8，stream流进阶操作</h2><p>流操作的优势：</p>
<ol>
<li>可并行操作，解决单线程的不足</li>
<li>处理更具有针对性，处理效率高</li>
</ol>
<p>流的常用操作结构图：<br>  <img src="http://localhost:4000/2021/07/09/emacs-org%E6%A8%A1%E5%BC%8F%E7%AC%AC%E4%BA%8C%E7%AF%87/001.png" alt="结构图"></p>
<ol>
<li>筛选<ul>
<li>distinct 去重<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">List&lt;Integer&gt; numbers = Arrays.asList(<span class="number">1</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">4</span>);</span><br><span class="line">numbers.stream().filter(i -&gt; i % <span class="number">2</span> == <span class="number">0</span>).distinct().forEach(System.out::println);</span><br></pre></td></tr></table></figure></li>
<li>limit<blockquote>
<p>这个方法可以让我们只取stream中的前几个，值得注意的是当我们用Set集合来存储元素时，因为Set是无序的，所以每次我们取到的前几个元素也会是无序的。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">List&lt;Integer&gt; numbers = Arrays.asList(<span class="number">1</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">4</span>);</span><br><span class="line">numbers.stream().limit(<span class="number">3</span>).forEach(System.out::println);</span><br></pre></td></tr></table></figure></blockquote>
</li>
<li>skip <blockquote>
<p>这个方法可以让我们跳过元素，跳过多少个元素由我们指定</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">List&lt;Integer&gt; numbers = Arrays.asList(<span class="number">1</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">4</span>);</span><br><span class="line">numbers.stream().skip(<span class="number">3</span>).forEach(System.out::println);</span><br></pre></td></tr></table></figure></blockquote>
</li>
</ul>
</li>
<li>映射<ul>
<li>map<blockquote>
<p>这个方法接受一个Lambda表达式，它会遍历整个流把这个函数作用到每个元素上，然后把输出的结果放到一个新流中。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 获取每个元素的name属性放入一个新流中，然后把这个流转为List类型。</span></span><br><span class="line">List&lt;Person&gt; names = peoples.stream().map(Person::getName).collect(toList());</span><br><span class="line"><span class="comment">// 获取每个元素的字符串长度放入新流中，然后转为List类型。</span></span><br><span class="line">List&lt;String&gt; words = Arrays.asList(<span class="string">"AA"</span>, <span class="string">"B"</span>, <span class="string">"CCC"</span>, <span class="string">"DDDDDD"</span>);</span><br><span class="line">List&lt;Integer&gt; wordLengths = words.stream().map(String::length).collect(toList());</span><br></pre></td></tr></table></figure></blockquote>
</li>
<li>flatmap<blockquote>
<p>这个方法比较特殊，它的作用是把多个相同类型的流连成一个流，我们看下面的代码，目的是为了把集合中的字符串都拆成单个字符然后放到一个集合，但是如果直接用map方法的话返回的List是String[]类型的，这是因为word.split(“”)返回的结果就是这个类型的。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">List&lt;String&gt; words = Arrays.asList(<span class="string">"Hello"</span>, <span class="string">"world"</span>);</span><br><span class="line">List&lt;String[]&gt; list = words.stream().map(word -&gt; word.split(<span class="string">""</span>)).collect(toList());</span><br></pre></td></tr></table></figure>
<p>这里要提到Arrays.stream()这个方法，它的作用是接受一个数组，然后把这个数组里的元素转为一个流，所以我们可以尝试使用这个方法来改进下上面的代码。但是我们发现还是有问题，返回集合类型是Stream<string>，因为map(Arrays::stream)把数组里的每个元素都弄成了一个流.</string></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">List&lt;String&gt; words = Arrays.asList(<span class="string">"Hello"</span>, <span class="string">"world"</span>);</span><br><span class="line">List&lt;Stream&lt;String&gt;&gt; list = words.stream().map(word -&gt; word.split(<span class="string">""</span>))</span><br><span class="line">    .map(Arrays::stream).collect(toList());</span><br></pre></td></tr></table></figure>
<p>现在flatmap的作用就出来了，我们把代码改进下，改成使用flatmap接受Arrays::stream，它的作用正是在上面map(Arrays::stream)的基础上把集合里的流里面的元素合并成一个流，所以返回的List类型就是String类型的。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">List&lt;String&gt; words = Arrays.asList(<span class="string">"Hello"</span>, <span class="string">"world"</span>);</span><br><span class="line">List&lt;String&gt; list = words.stream().map(word -&gt; word.split(<span class="string">""</span>))</span><br><span class="line">    .flatmap(Arrays::stream).collect(toList());</span><br></pre></td></tr></table></figure></blockquote>
</li>
</ul>
</li>
<li>匹配<blockquote>
<p>stream同样也提供了很多方法来检查集合中是否包含了某个指定的值。注意，这些方法都属于 终端操作 ，也就是说调用了这些方法就会关闭流。</p>
<ul>
<li>allMatch<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">List&lt;String&gt; numbers = Arrays.asList(<span class="string">"Hello"</span>, <span class="string">"World"</span>);</span><br><span class="line"><span class="type">boolean</span> <span class="variable">flag</span> <span class="operator">=</span> numbers.stream().allMatch(string -&gt; string.contains(<span class="string">"z"</span>));</span><br><span class="line">System.out.println(flag);</span><br></pre></td></tr></table></figure></li>
<li>anyMatch<br>这个方法会检查流中是否至少有一个元素匹配给定的值，返回一个boolean值。<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">List&lt;String&gt; numbers = Arrays.asList(<span class="string">"Hello"</span>, <span class="string">"World"</span>);</span><br><span class="line"><span class="type">boolean</span> <span class="variable">flag</span> <span class="operator">=</span> numbers.stream().anyMatch(string -&gt; string.contains(<span class="string">"z"</span>));</span><br><span class="line">System.out.println(flag);</span><br></pre></td></tr></table></figure></li>
<li>noneMatch<br>这个方法则是和allMatch方法做相反的操作。<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">List&lt;String&gt; numbers = Arrays.asList(<span class="string">"Hello"</span>, <span class="string">"World"</span>);</span><br><span class="line"><span class="type">boolean</span> <span class="variable">flag</span> <span class="operator">=</span> numbers.stream().noneMatch(string -&gt; string.contains(<span class="string">"z"</span>));</span><br><span class="line">System.out.println(flag);</span><br></pre></td></tr></table></figure></li>
</ul>
</blockquote>
</li>
<li>查找<ul>
<li>findAny<blockquote>
<p>这个方法需要配合filter方法使用，返回把筛选出来的第一个元素。注意，这里返回的是Optional类型的对象，这个对象是Java 8新增的专门为了防止返回数据的时候遇到null的情况，后续再作详细了解，目前只需要知道它有个isPresent方法来判断元素是否为空，get方法用来取值。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">List&lt;String&gt; numbers = Arrays.asList(<span class="string">"Hello"</span>, <span class="string">"World"</span>);</span><br><span class="line">Optional&lt;String&gt; optional= numbers.stream().filter(string -&gt; string.contains(<span class="string">"l"</span>)).findAny();</span><br><span class="line"><span class="keyword">if</span>(optional.isPresent()){</span><br><span class="line">    System.out.println(optional.get());</span><br><span class="line">}</span><br></pre></td></tr></table></figure></blockquote>
</li>
<li>findFirst<blockquote>
<p>这个方法是用来取流中第一个元素的，目前看来好像没什么用，但是有时候我们可能会对流进行复杂的筛选，再选取筛选后的流中第一个元素。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">List&lt;String&gt; numbers = Arrays.asList(<span class="string">"Hello"</span>, <span class="string">"World"</span>);</span><br><span class="line">Optional&lt;String&gt; optional= numbers.stream().findFirst();</span><br><span class="line">System.out.println(optional.toString());</span><br></pre></td></tr></table></figure></blockquote>
</li>
</ul>
</li>
<li><p>归约</p>
<p>归约就是把整个流归约成一个值的操作，比如求集合中最大的元素、所有元素值的和之类的操作.</p>
<ul>
<li>reduce<blockquote>
<p>这个方法就是用来对元素的值进行操作的，我们这里做加法运算。它接受两个参数，第一个是初始值，就是开始计算前就已经有一个数值了。第二个参数是一个Lambda表达式，用来对各个元素做计算。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">List&lt;Integer&gt; list = Arrays.asList(<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>,<span class="number">5</span>);</span><br><span class="line"><span class="type">int</span> <span class="variable">sum</span> <span class="operator">=</span> list.stream().reduce(<span class="number">0</span>,(a,b) -&gt; a - b);</span><br><span class="line">System.out.println(sum);</span><br></pre></td></tr></table></figure>
</blockquote>
</li>
</ul>
</li>
</ol>
<h3 id="分组与分区"><a href="#分组与分区" class="headerlink" title="分组与分区"></a>分组与分区</h3><ul>
<li>分组<blockquote>
<p>当我们想要将流中数据分组时只需要调用Collectors.groupingBy()方法即可，这个方法会根据我们传递进来的字段进行分组，比如下面这个例子是按学生的名字分组的，只需要传递Studen::getName方法引用就可以了。最后回返回一个Map，key值就是名字，value是一个List集合，存放所有名字等于key的对象，这里为了方便阅读进行了一下格式化，没有直接打印map。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//把学生按名字分组</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">groupByName</span><span class="params">()</span>{</span><br><span class="line">    Map&lt;String,List&lt;Student&gt;&gt; map = students.stream().collect(Collectors.groupingBy(Student::getName));</span><br><span class="line">    <span class="type">Set</span> <span class="variable">ketSet</span> <span class="operator">=</span> map.keySet();</span><br><span class="line">    <span class="keyword">for</span> (Object key:ketSet){</span><br><span class="line">        System.out.println(map.get(key));</span><br><span class="line">        System.out.println(<span class="string">"=============="</span>);</span><br><span class="line">    }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>上面那个例子是直接按成绩分组，但是有时候需要对数据按多个属性分组，比如想要将同个科目下同样成绩的对象分为一类，只需要在原来分组的基础上再进行分组，调用Collectors.groupingBy()的另一个重载方法，第二个参数再传递一个分组操作即可，要注意的是因为我们进行了二次分组所以返回的Map也多嵌套了一层，最外层的key是一层分组的成绩，里面的key则是科目的名称，value则是名称相同的对象集合。可以看到运行结果最外一层把成绩相同的放一起了，里面那层则把名字相同的又放一起了。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//把学生按科目成绩分组</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">groupByMarkAndSubject</span><span class="params">()</span>{</span><br><span class="line">    Map&lt;Double,Map&lt;String,List&lt;Student&gt;&gt;&gt; map =</span><br><span class="line">              students.stream().collect(Collectors.groupingBy(Student::getMark,Collectors.groupingBy(Student::getSubject)));</span><br><span class="line">    <span class="type">Set</span> <span class="variable">ketSet</span> <span class="operator">=</span> map.keySet();</span><br><span class="line">    <span class="keyword">for</span> (Object key:ketSet){</span><br><span class="line">        System.out.println(map.get(key));</span><br><span class="line">        System.out.println(<span class="string">"=============="</span>);</span><br><span class="line">    }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>上面两个例子的分组产生的Map的key值都是直接取的对象里的值，其实也可以自己规定分组的规则和key的名字，我们可以在Lambda的右边使用大括号，在大括号里面写逻辑代码，只要保证返回的值是符合格式的就可以，比如现在就是以85分为界限进行分组，Map的key值也也就是我们返回的两个值。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//找出所有成绩在85之上的学生(包括85)分为合格，85之下的为不合格</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">getMarkByStandard</span><span class="params">()</span>{</span><br><span class="line">    Map&lt;String,List&lt;Student&gt;&gt; map = students.stream().collect(Collectors.groupingBy(student -&gt;{</span><br><span class="line">        <span class="keyword">if</span> (student.getMark().intValue() &gt;= <span class="number">85</span>){</span><br><span class="line">            <span class="keyword">return</span> <span class="string">"合格"</span>;</span><br><span class="line">        }<span class="keyword">else</span>{</span><br><span class="line">            <span class="keyword">return</span> <span class="string">"不合格"</span>;</span><br><span class="line">        }</span><br><span class="line">    }));</span><br><span class="line"></span><br><span class="line">    System.out.println(map.get(<span class="string">"合格"</span>));</span><br><span class="line">    System.out.println(map.get(<span class="string">"不合格"</span>));</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>有时候我们只是想要统计每个分组的数量，而不是获得每个分组里面元素的详细信息，这个也是可以实现的。只是在上述的二级分组基础上调用了Collectors.counting()方法来统计每个分组里面的数量</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//计算每个年级合格人数和不合格的人数</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">groupByMarkAndGradeCounts</span><span class="params">()</span>{</span><br><span class="line">    Map&lt;String,Map&lt;String,Long&gt;&gt; map = students.stream().collect(Collectors.groupingBy(Student::getGrade,</span><br><span class="line">            Collectors.groupingBy(student -&gt; {</span><br><span class="line">                <span class="keyword">if</span> (student.getMark().intValue() &gt;= <span class="number">85</span>){</span><br><span class="line">                    <span class="keyword">return</span> <span class="string">"合格"</span>;</span><br><span class="line">                }<span class="keyword">else</span>{</span><br><span class="line">                    <span class="keyword">return</span> <span class="string">"不合格"</span>;</span><br><span class="line">                }</span><br><span class="line">            },Collectors.counting())</span><br><span class="line">        )</span><br><span class="line">    );</span><br><span class="line">    System.out.println(map);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>在分组的基础上获得分数最高的学生的信息</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//在分组的基础上获得成绩最高的学生信息</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">getLargeByMarkAndGrade</span><span class="params">()</span>{</span><br><span class="line">    Map&lt;String,Optional&lt;Student&gt;&gt; map = students.stream().collect(Collectors.groupingBy(Student::getGrade,</span><br><span class="line">            Collectors.maxBy(Comparator.comparing(Student::getMark)</span><br><span class="line">                )</span><br><span class="line">            ));</span><br><span class="line">    System.out.println(map);</span><br><span class="line">}</span><br></pre></td></tr></table></figure></blockquote>
</li>
<li>分区<blockquote>
<p>分区其实就是特殊的分组，它只是固定将流中的数据分为两组，大致用法其实和分组一样。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">partitionByStandard</span><span class="params">()</span>{</span><br><span class="line">  Map&lt;String,Map&lt;Boolean,Long&gt;&gt; map = students.stream().collect(Collectors.groupingBy(Student::getGrade,</span><br><span class="line">      Collectors.partitioningBy(student -&gt; {</span><br><span class="line">          <span class="keyword">if</span> (student.getMark().intValue() &gt;= <span class="number">85</span>){</span><br><span class="line">              <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line">          }<span class="keyword">else</span>{</span><br><span class="line">              <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line">          }</span><br><span class="line">      },Collectors.counting())</span><br><span class="line">      )</span><br><span class="line">  );</span><br><span class="line">  System.out.println(map);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
</blockquote>
</li>
</ul>
<h2 id="将本地jar包安装到本地maven仓库"><a href="#将本地jar包安装到本地maven仓库" class="headerlink" title="将本地jar包安装到本地maven仓库"></a>将本地jar包安装到本地maven仓库</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mvn install:install-file -DgroupId=com.abc -DartifactId=mavenTest -Dversion=1.0.0 -Dpackaging=jar -Dfile=C:\myfile\test.jar</span><br></pre></td></tr></table></figure>

    </div>

    
    
    
        

  <div class="followme">
    <p>欢迎关注我的其它发布渠道</p>

    <div class="social-list">

        <div class="social-item">
          <a target="_blank" class="social-link" href="/atom.xml">
            <span class="icon">
              <i class="fa fa-rss"></i>
            </span>

            <span class="label">RSS</span>
          </a>
        </div>
    </div>
  </div>


      <footer class="post-footer">

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2021/07/08/doom-emacs%E6%8F%92%E4%BB%B6%E8%87%AA%E5%AE%9A%E4%B9%89%E7%AF%87/" rel="prev" title="doom-emacs插件自定义篇">
      <i class="fa fa-chevron-left"></i> doom-emacs插件自定义篇
    </a></div>
      <div class="post-nav-item">
    <a href="/2021/07/09/macbook%E5%A4%96%E6%8E%A5%E6%98%BE%E7%A4%BA%E5%99%A8%E4%BD%BF%E7%94%A8/" rel="next" title="macbook外接显示器使用">
      macbook外接显示器使用 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#git%E4%B8%AD%E6%9F%A5%E7%9C%8B%E4%B8%80%E4%B8%AA%E6%96%87%E4%BB%B6%E5%9C%A8%E5%93%AA%E4%BA%9B%E6%8F%90%E4%BA%A4%E4%BF%AE%E6%94%B9%E8%BF%87"><span class="nav-number">1.</span> <span class="nav-text">git中查看一个文件在哪些提交修改过</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%9F%A5%E7%9C%8B%E5%8E%86%E5%8F%B2%E4%B8%AD%E6%9F%90%E6%AC%A1%E6%8F%90%E4%BA%A4%E7%9A%84%E6%96%87%E4%BB%B6%E5%86%85%E5%AE%B9"><span class="nav-number">1.1.</span> <span class="nav-text">查看历史中某次提交的文件内容</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%94%A8%E8%BF%99%E4%B8%AA%E7%89%88%E6%9C%AC%E4%B8%AD%E7%9A%84%E6%96%87%E4%BB%B6%E6%9B%B4%E6%96%B0%E5%B7%A5%E4%BD%9C%E5%8C%BA%E7%9A%84%E6%96%87%E4%BB%B6%EF%BC%8C%E5%B9%B6%E5%9B%9E%E6%BB%9A%E6%AD%A4%E6%96%87%E4%BB%B6"><span class="nav-number">1.2.</span> <span class="nav-text">用这个版本中的文件更新工作区的文件，并回滚此文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%AF%94%E8%BE%83%E5%8E%86%E5%8F%B2%E4%B8%AD%E4%B8%8D%E5%90%8C%E7%89%88%E6%9C%AC%E7%9A%84%E6%96%87%E4%BB%B6"><span class="nav-number">1.3.</span> <span class="nav-text">比较历史中不同版本的文件</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#emacs%E5%B0%86%E5%8F%AA%E8%AF%BB%E6%A8%A1%E5%BC%8F%E4%BF%AE%E6%94%B9%E4%B8%BA%E5%8F%AF%E5%86%99%E6%A8%A1%E5%BC%8F%EF%BC%9F"><span class="nav-number">2.</span> <span class="nav-text">emacs将只读模式修改为可写模式？</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BB%A5%E5%8F%AA%E8%AF%BB%E6%A8%A1%E5%BC%8F%E6%89%93%E5%BC%80%E4%B8%80%E4%B8%AA%E6%96%87%E4%BB%B6"><span class="nav-number">2.1.</span> <span class="nav-text">以只读模式打开一个文件</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#DateTimeFormat-%E5%92%8C-JsonFormat%E4%B8%A4%E4%B8%AA%E6%B3%A8%E8%A7%A3%E7%9A%84%E4%BD%BF%E7%94%A8"><span class="nav-number">3.</span> <span class="nav-text">@DateTimeFormat 和 @JsonFormat两个注解的使用</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#java8%EF%BC%8Cstream%E6%B5%81%E8%BF%9B%E9%98%B6%E6%93%8D%E4%BD%9C"><span class="nav-number">4.</span> <span class="nav-text">java8，stream流进阶操作</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%88%86%E7%BB%84%E4%B8%8E%E5%88%86%E5%8C%BA"><span class="nav-number">4.1.</span> <span class="nav-text">分组与分区</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%B0%86%E6%9C%AC%E5%9C%B0jar%E5%8C%85%E5%AE%89%E8%A3%85%E5%88%B0%E6%9C%AC%E5%9C%B0maven%E4%BB%93%E5%BA%93"><span class="nav-number">5.</span> <span class="nav-text">将本地jar包安装到本地maven仓库</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">田园隐士</p>
  <div class="site-description" itemprop="description">talk is cheap, show me the code</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">347</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
        <span class="site-state-item-count">53</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
        <span class="site-state-item-count">115</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">田园隐士</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
    <span title="站点总字数">587k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">8:53</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://muse.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  
      

<script>
  if (typeof MathJax === 'undefined') {
    window.MathJax = {
      loader: {
          load: ['[tex]/mhchem'],
        source: {
          '[tex]/amsCd': '[tex]/amscd',
          '[tex]/AMScd': '[tex]/amscd'
        }
      },
      tex: {
        inlineMath: {'[+]': [['$', '$']]},
          packages: {'[+]': ['mhchem']},
        tags: 'ams'
      },
      options: {
        renderActions: {
          findScript: [10, doc => {
            document.querySelectorAll('script[type^="math/tex"]').forEach(node => {
              const display = !!node.type.match(/; *mode=display/);
              const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
              const text = document.createTextNode('');
              node.parentNode.replaceChild(text, node);
              math.start = {node: text, delim: '', n: 0};
              math.end = {node: text, delim: '', n: 0};
              doc.math.push(math);
            });
          }, '', false],
          insertedScript: [200, () => {
            document.querySelectorAll('mjx-container').forEach(node => {
              let target = node.parentNode;
              if (target.nodeName.toLowerCase() === 'li') {
                target.parentNode.classList.add('has-jax');
              }
            });
          }, '', false]
        }
      }
    };
    (function () {
      var script = document.createElement('script');
      script.src = '//cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js';
      script.defer = true;
      document.head.appendChild(script);
    })();
  } else {
    MathJax.startup.document.state(0);
    MathJax.texReset();
    MathJax.typeset();
  }
</script>

    

  

</body>
</html>
